#include<stdio.h>
#include"sqstack.h"

int main()
{
    //初始化一个栈,栈里面没有任何用户数据
    Sqstack * s = InitStack();
    printf("栈是否为空:%d\n", StackIsEmpty(s) );
    printf("栈的长度:%d\n", StackSize(s) );
    Datatype a = 0; //可用的空间
    if( GetTop(s,&a) )
    {
        printf("获取成功:%d\n",a);
    }else 
    {
        printf("获取失败!\n");
    }

    Push(s,1);
    Push(s,2);
    Push(s,3);
    Push(s,4);
    Push(s,5);

    printf("==============================\n");

    printf("栈是否为空:%d\n", StackIsEmpty(s) );
    printf("栈的长度:%d\n", StackSize(s) );
    if( GetTop(s,&a) )
    {
        printf("获取成功:%d\n",a);
    }else 
    {
        printf("获取失败!\n");
    }

    Pop(s);
    Pop(s);

    printf("==============================\n");

    printf("栈是否为空:%d\n", StackIsEmpty(s) );
    printf("栈的长度:%d\n", StackSize(s) );
    if( GetTop(s,&a) )
    {
        printf("获取成功:%d\n",a);
    }else 
    {
        printf("获取失败!\n");
    }

    printf("==============================\n");
    while( !StackIsEmpty(s))
    {
        GetTop(s,&a);
        printf("value = %d\n",a);

        Pop(s);
    }


    //销毁
    DestoryStack(s);

    return 0;
}